package pers.lonestar.framework.utils.support.converters;

import java.math.BigDecimal;

import pers.lonestar.framework.utils.support.enums.CellDataTypeEnum;
import pers.lonestar.framework.utils.support.metadata.CellData;

public class FloatConverter implements Converter<Float> {
    @Override
    public Float convertToJavaObject(CellData<Float> cellData) {
        return cellData.getNumberValue().floatValue();
    }

    @Override
    public CellData<Float> convertToCellData(Float data) {
        CellData<Float> cellData = new CellData<>();
        cellData.setNumberValue(BigDecimal.valueOf(data));
        cellData.setType(CellDataTypeEnum.NUMBER);
        cellData.setData(data);
        return cellData;
    }
}
